def registration_params
  {
      user: {
          email: 'foo@bar.com',
          password: 'P@ssw0rd!'
      }
  }
end

When /I call the API <(\w+) ([\/\w]+)>(?: with ([a-z ]+) as (query string|request body))?/ do |verb, path, params, param_type|
  params = send params.tr(' ', '_')
  query, body = nil, nil
  case param_type
    when 'query string'
      query = params
    when 'request body'
      body = params
  end
  send verb.downcase, path,
       query: query,
       body: body do |response, status|
    @response = response
    @status = status
  end
end